package com.drojian.thread.waitandnotify2;

import com.drojian.thread.waitandnotify.Desk;

import java.util.concurrent.ArrayBlockingQueue;

public class Food extends Thread {
    ArrayBlockingQueue<String> queue;
    public Food(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }
    @Override
    public void run() {
        while (true) {
            while (true) {
                try {
                    String take = queue.take();
                    System.out.println(take);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
